package com.fanxl.utils.pdf.controller;

import com.fanxl.utils.pdf.service.PdfTableService;
import com.fanxl.utils.pdf.utils.PdfUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @description:
 * @author: fanxiaole
 * @date: 2022/1/25 15:53
 */
@RestController
@RequestMapping("/pdf")
public class PdfController {

    @Resource
    PdfTableService pdfTableService;

    //下载pdf文件
    @GetMapping("/down-pdf")
    public void downPdf() {
        PdfUtil.downPdfFile(pdfTableService.createPdfFile());
    }

    @GetMapping("/simple-pdf/{column}")
    public void simpleDownPdf(@PathVariable Integer column) {
        PdfUtil.downPdfFile(pdfTableService.createSimplePdfFile(column));
    }

}
